package com.sxpcwlkj.system.controller;

import cn.dev33.satoken.annotation.SaCheckRole;
import com.sxpcwlkj.common.code.controller.BaseController;
import com.sxpcwlkj.common.utils.R;
import com.sxpcwlkj.system.entity.bo.SysOssConfigBo;
import com.sxpcwlkj.system.entity.vo.SysOssConfigVo;
import com.sxpcwlkj.system.service.SysOssConfigService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
* 对象存储配置表
*
* @author 西决 942879858@qq.com
* @since 1.0.0 2024-07-07
*/
@Slf4j
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("system/sysOssConfig")
public class SysOssConfigController extends BaseController{
    private final SysOssConfigService baseService;

    @SaCheckRole("super_admin")
    @GetMapping
    public R<String> queryDef() {
        return success("success",baseService.queryDef());
    }
    @SaCheckRole("super_admin")
    @GetMapping("/key/{key}")
    public R<SysOssConfigVo> queryByKey(@PathVariable String key) {
        return success(baseService.selectVoByKey(key));
    }

    @SaCheckRole("super_admin")
    @PutMapping
    public R<Boolean> edit(@Validated @RequestBody(required = false) SysOssConfigBo bo) {
        return success(baseService.updateByIdXml(bo));
    }

}
